/*
 * @Author: 0x9DEFA478
 * @Date: 2025-07-26 20:07:26
 * @LastEditTime: 2025-07-27 22:20:58
 * @LastEditors: 0x9DEFA478
 * @Description: 
 * 
 */
#ifndef hAtomic_H_Atomic_std_HPP_
#define hAtomic_H_Atomic_std_HPP_
#include <atomic>
#include "./H_Atomic_Empty.hpp"




namespace H{

  namespace Atomic{

    class Count_size_std{
      public:
        using Type=size;
      public:
        Count_size_std(size value):value(value){}
        ~Count_size_std(){}

        size load(){return value.load();}
        void store(size value){this->value.store(value);}
#if __cplusplus > 201703L
        size increment(size value){
          return this->value.fetch_add(value,std::memory_order::relaxed);
        }
        size decrement(size value){
          return this->value.fetch_sub(value,std::memory_order::relaxed);
        }
#else
        size increment(size value){
          return this->value.fetch_add(value,std::memory_order_relaxed);
        }
        size decrement(size value){
          return this->value.fetch_sub(value,std::memory_order_relaxed);
        }
#endif
      private:
        std::atomic<size> value;
    };

    class Count_usize_std{
      public:
        using Type=usize;
      public:
        Count_usize_std(size value):value(value){}
        ~Count_usize_std(){}

        usize load(){return value.load();}
        void store(usize value){this->value.store(value);}
#if __cplusplus > 201703L
        usize increment(usize value){
          return this->value.fetch_add(value,std::memory_order::relaxed);
        }
        usize decrement(usize value){
          return this->value.fetch_sub(value,std::memory_order::relaxed);
        }
#else
        usize increment(usize value){
          return this->value.fetch_add(value,std::memory_order_relaxed);
        }
        usize decrement(usize value){
          return this->value.fetch_sub(value,std::memory_order_relaxed);
        }
#endif
      private:
        std::atomic<usize> value;
    };

  }

}




#endif //hAtomic_H_Atomic_std_HPP_
